package org.example.demo.controller.userController;

import io.swagger.annotations.ApiOperation;
import org.example.demo.common.api.CommonResult;
import org.example.demo.dto.ProductDetail.ProductDetailParam;
import org.example.demo.dto.ProductShowParam;
import org.example.demo.service.userService.ProductService;
import org.example.demo.service.userService.ShopService;
import org.example.mbg.model.Shop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 商店相关需求
 */


@Controller
@RequestMapping(value = "/user/shop")
public class ShopController {
    @Autowired
    private ShopService shopService;

    @ApiOperation("查看店铺（将商品对应的店铺信息返回给前端）")
    @RequestMapping(value = "/show", method = RequestMethod.GET)
    @ResponseBody
    public Shop show(Long id) {
        return shopService.show(id);
    }

    @ApiOperation("显示当前商家的所有商品")
    @RequestMapping(value = "/products", method = RequestMethod.GET)
    @ResponseBody
    public List<ProductShowParam> listProducts(Long id) {
        return shopService.listProducts(id);
    }

}
